package com.stone.framework.batch.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.SkipListener;
import org.springframework.stereotype.Component;

@Component
public class LoggingSkipListener<T extends Object, S extends Object> implements SkipListener<T, S> {

    private static final Logger LOGGER = LoggerFactory.getLogger(LoggingSkipListener.class);

    @Override
    public void onSkipInRead(Throwable t) {
        LOGGER.error("read error", t);
    }

    @Override
    public void onSkipInWrite(S item, Throwable t) {
        LOGGER.error("write error, item : " + item.toString(), t);
    }

    @Override
    public void onSkipInProcess(T item, Throwable t) {
        LOGGER.error("process error, item : " + item.toString(), t);
    }

}
